<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>大写切换提示</title>
    <script src="vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" @keyup.Caps-Lock="change" v-model="value">
        <h2>{{msg}}</h2>
    </div>

    <script>
        var vm=new Vue({
            el:"#app",
            data(){
                return{
                    value:'',
                    msg:' '
                }
            },
            methods:{
                change(){
                    if(this.msg==' '){
                        this.msg='当前已切换大写模式!'
                    }else{
                        this.msg=' '
                    }
                }
            }
        })
    </script>
</body>
</html>